package com.dican.portal.pedidos;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.dican.portal.beans.Representante;

public class Seguranca extends HttpServlet {
	private static final long serialVersionUID = 1L;

    public Seguranca() {
        super();
    }
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		String pagina = request.getParameter("pagina");
		Representante rep = (Representante)session.getAttribute("rep");
		String id = rep.getBpid();
		if(id=="")
			response.sendRedirect("logout.jsp");
		else
		{
			if(pagina.equals("Digitar+Pedido"))
			{
				RequestDispatcher view = request.getRequestDispatcher("FillCli");
				view.forward(request, response);
			}
			else
				response.sendRedirect("logout.jsp");
		}
	}
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			doGet(request,response);
	}

}
